package com.zbest.zpay.gw.dal.dao;

import javax.annotation.Resource;

import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.stereotype.Service;

import com.zbest.common.lang.enums.BizCode;
import com.zbest.common.lang.exception.ZpayException;
import com.zbest.zpay.gw.dal.mapper.GwTransactionUniqueMapper;
import com.zbest.zpay.gw.dal.model.GwTransactionUniqueDO;

/**
 * Created by wenfeihu on 16/5/20.
 */
@Service
public class GwTransactionUniqueDAO {

    @Resource
    private GwTransactionUniqueMapper gwTransactionUniqueMapper;

    public void insert(GwTransactionUniqueDO gwTransactionUniqueDO) {
        try {
            gwTransactionUniqueMapper.insert(gwTransactionUniqueDO);
        } catch (DataIntegrityViolationException e) {
            throw new ZpayException(BizCode.DUPLICATED_ERROR);
        }
    }

}
